package com.changdu.seatunnel.admin.config.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

import lombok.Getter;

@Getter
public enum StartModeEnum {
	
	// kafka
	EARLIEST("earliest"),
	LATEST("latest"),
	TIMESTAMP("timestamp"),
	// mysql
	INITIAL("INITIAL"),
	SPECIFIC("specific"),
	//none 
	NONE("none")
    ;

    @EnumValue
    private final String mode;
    
    StartModeEnum(String mode) {
        this.mode = mode;
    }

	public static StartModeEnum fromCode(String mode) {
		for (StartModeEnum sync : StartModeEnum.values()) {
			if (sync.mode.equals(mode.toLowerCase())) {
				return sync;
			}
		}
		return NONE;
	}
	
}